package com.my_musc_service.controller;

import com.my_musc_service.common.R;
import com.my_musc_service.entity.Log;
import com.my_musc_service.service.LogService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * (Log)表控制层
 *
 * @author makejava
 * @since 2021-06-10 20:44:47
 * @description 搜索记录相关
 */
@RestController
@RequestMapping("log")
public class LogController {
    /**
     * 服务对象
     */
    @Resource
    private LogService logService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public Log selectOne(Integer id) {
        return this.logService.queryById(id);
    }

    @GetMapping("selectLog")
    public R selectLog(Log log) {
        List<Log> logList = this.logService.queryByLog(log);
        return R.ok().data("logList", logList);
    }

    @PostMapping("delete")
    public R delete(@RequestBody Log log) {
        Integer rows = logService.delete(log);
        return R.ok();
    }

}
